Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
rollup-plugin-serve
Advanced tools
npm install --save-dev rollup-plugin-serve
yarn add rollup-plugin-serve
// rollup.config.js
import serve from 'rollup-plugin-serve'
export default {
input: 'src/main.js',
output: {
file: 'dist/bundle.js',
format: ...
},
plugins: [
serve('dist')
]
}
By default it serves the current project folder. Change it by passing a string:
serve('public') // will be used as contentBase
// Default options
serve({
// Launch in browser (default: false)
open: true,
// Page to navigate to when opening the browser.
// Will not do anything if open=false.
// Remember to start with a slash.
openPage: '/different/page',
// Show server address in console (default: true)
verbose: false,
// Folder to serve files from
contentBase: '',
// Multiple folders to serve from
contentBase: ['dist', 'static'],
// Set to true to return index.html (200) instead of error page (404)
historyApiFallback: false,
// Path to fallback page
historyApiFallback: '/200.html',
// Options used in setting up server
host: 'localhost',
port: 10001,
// By default server will be served over HTTP (https: false). It can optionally be served over HTTPS
https: {
key: fs.readFileSync('/path/to/server.key'),
cert: fs.readFileSync('/path/to/server.crt'),
ca: fs.readFileSync('/path/to/ca.pem')
},
//set headers
headers: {
'Access-Control-Allow-Origin': '*',
foo: 'bar'
},
// set custom mime types, usage https://github.com/broofa/mime#mimedefinetypemap-force--false
mimeTypes: {
'application/javascript': ['js_commonjs-proxy']
}
// execute function after server has begun listening
onListening: function (server) {
const address = server.address()
const host = address.address === '::' ? 'localhost' : address.address
// by using a bound function, we can access options as `this`
const protocol = this.https ? 'https' : 'http'
console.log(`Server listening at ${protocol}://${host}:${address.port}/`)
}
})
Please see CHANGELOG for more information what has changed recently.
Contributions and feedback are very welcome.
This project aims to stay lean and close to standards. New features should encourage to stick to standards. Options that match the behaviour of webpack-dev-server are always ok.
To get it running:
npm install
npm run build
The MIT License (MIT). Please see License File for more information.
FAQs
Serve your rolled up bundle
The npm package rollup-plugin-serve receives a total of 30,375 weekly downloads. As such, rollup-plugin-serve popularity was classified as popular.
We found that rollup-plugin-serve demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.